Welcome to “Overview of Common Linux Shell
Commands.” After watching this video, you will be able
to: Define what a shell is. List shell command applications, and Recall common shell commands. A shell is a powerful user interface for Unix-like
operating systems. It can interpret commands and run other programs. A shell, which enables access to files, utilities,
and applications, is also an interactive language. A shell is also a scripting language. And
it can be used to automate tasks. The default shell on Linux systems is usually
Bash. Other shells include ‘the Bourne shell, S H,’ ‘the Korn shell,’ K S H, ‘T
C shell,’ ‘Z shell,’ and ‘fish’. For this course, we will only use the Bash
shell, which stands for ‘bourne again shell.’ To find out what the default is, enter ‘printenv
SHELL’ on the command line. This returns the path to the default shell program, which
in this case is bash. If your default shell is not Bash, you can
always switch to it, simply by entering 'bash' on the command line. We will use the dollar
sign to represent the command prompt throughout this course. Outside of this course, you may
encounter the ‘greater than’ symbol being used for the same purpose. Applications of shell commands include:​ Getting information​, Navigating and working with files and directories, Printing file and string contents​, File compression and archiving​, Performing network operations, Monitoring performance and status of the system,
its components and applications, and Running batch jobs, such as ETL operations. Some common shell commands for getting information include: whoami – which returns the user's username, id – which returns the current user, and
group IDs, uname – returns the operating system name, ps – displays running processes and their
IDs, top – displays running processes and resource
usage including memory, CPU, and IO, df – shows information about mounted file systems, man – fetches the reference manual for any
shell command, and date – prints today's date. Some common shell commands for working with
files include: cp – copy file, mv – change file name or path, rm – remove file, touch – create empty file, update file timestamp, changemod – change or modify file permissions, wc – get count of lines, words, characters in file, and grep – return lines in file matching pattern. Very common shell commands for navigating
and working with directories include: LS – lists the files and directories in
the current directory, find – used to find files matching a pattern
in the current directory tree, pwd – prints the current, or ‘present
working,’ directory, mkdir – makes a new directory, cd – changes the current directory to another
directory, and rmdir – removes an entire directory. For printing file contents or strings, common
commands include: cat – which prints the entire contents of
a file, more – used to print file contents one page
at a time, head – for printing just the first ‘N’
lines of a file, tail – for printing the last ‘N’ lines
of a file, and the very common echo command – which 'echoes' an input string
by printing it. It can also ‘echo’ the value of a variable. Shell commands related to file compression
and archiving applications include: tar – which is used to archive a set of
files, zip – which compresses a set of files, and unzip – which extracts files from a compressed
or zipped archive. Networking applications include the following: hostname – prints the host name, ping – sends packets to a URL and prints
the response, ifconfig – displays or configures network
interfaces on the system, curl – displays the contents of a file located
at a URL, and the wget command can be used to download a file
from a URL. We should mention that if you happen to be
running a Windows machine, and you want to run Linux on it, you can do so in various
ways.​ Linux can be installed on a separate drive partition. Switching between the two
operating systems requires a reboot. Alternatively, you can install Linux on a virtual machine,
or you can install a Linux emulator such as CygWin, or use the Windows Subsystem
for Linux, a compatibility layer for running Linux binary executables natively on Windows. In this video, you learned that: A shell is an interactive user interface for
running commands, a scripting language, and an interactive language. Shell commands are used for navigating and
working with files and directories. Shell commands can be used for file compression. The curl and wget commands, respectively,
can be used to display and download files from URLs. The echo command prints string or variable
values. The cat and tail commands are used to display
file contents.